//
//  UIButton+Extension.swift
//  weibo
//
//  Created by mac on 16/8/3.
//  Copyright © 2016年 zl. All rights reserved.
//

import UIKit

extension UIButton {
    
    convenience init(imageName:String,backgroundName:String) {
        self.init()
        
        setImage(UIImage(named:imageName), forState: UIControlState.Normal)
        setImage(UIImage(named:imageName + "_highlighted"), forState: UIControlState.Highlighted)
        setBackgroundImage(UIImage(named:backgroundName), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named:backgroundName + "_highlighted"), forState: UIControlState.Highlighted)
        
        sizeToFit()
        
    }
    
    
    
    convenience init (title : String,color : UIColor,imgName : String) {
        
        
        self.init()
        
        setTitle(title, forState: .Normal)
        setTitleColor(color, forState: .Normal)
        setBackgroundImage(UIImage(named: imgName), forState: .Normal)
        
        
    }
}
